function taFlushJump(obj) {
    $(obj).DataTable({
        "paging": true,
        "lengthChange": true,
        "searching": true,
        "ordering": true,
        "order": [[ 0, 'desc' ]],
        "info": true,
        "autoWidth": true,
        /* "scrollY": "500px",
         "scrollCollapse": "true",*/
        "language": {
            "emptyTable": "没有数据,请选择筛选条件",
            "search": "条件搜索:",
            "lengthMenu": "每页 _MENU_ 条记录",
            "zeroRecords": "没有找到记录",
            "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
            "infoEmpty": "无记录",
            "infoFiltered": "(从 _MAX_ 条记录过滤)",
            "paginate": {
                "sFirst": "首页",
                "sNext": "下一页",
                "sPrevious": "上一页",
                "sLast": "末页"
            }
        },
        "fnDrawCallback"    : function(){
            var table = obj;
            $(table+"_paginate .pagination").append("<span style='color: #666;'>&nbsp;到第&nbsp;</span><input style='width:40px;color: #666;' class='input-text' id='changePage' type='text'><span style='color: #666;'>&nbsp;页</span><a class='btn btn-default shiny' style='margin-bottom:5px;color: #666;margin-left:10px;' href='javascript:void(0);' id='dataTable-btn'>确认</a>");
            var oTable = $(table).dataTable();
            $('#dataTable-btn').click(function(e) {
                if($("#changePage").val() && $("#changePage").val() > 0) {
                    var redirectpage = $("#changePage").val() - 1;
                } else {
                    var redirectpage = 0;
                }
                oTable.fnPageChange(redirectpage);
            });
        },
    });
}

function taFlush(obj) {
    $(obj).DataTable({
        "paging": true,
        "lengthChange": true,
        "searching": true,
        "ordering": true,
        "order": [[ 0, 'desc' ]],
        "info": true,
        "autoWidth": true,
       /* "scrollY": "500px",
        "scrollCollapse": "true",*/
        "language": {
            "emptyTable": "没有数据,请选择筛选条件",
            "search": "条件搜索:",
            "lengthMenu": "每页 _MENU_ 条记录",
            "zeroRecords": "没有找到记录",
            "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
            "infoEmpty": "无记录",
            "infoFiltered": "(从 _MAX_ 条记录过滤)",
            "paginate": {
                "sFirst": "首页",
                "sNext": "下一页",
                "sPrevious": "上一页",
                "sLast": "末页"
            }
        }
    });
}


/*
  * fnDrawCallback
  * 无默认值
  * 每当draw事件发生时调用该函数，允许你动态编辑新建的dom对象的任何属性
  */
function taFlush2(obj) {
    $(obj).DataTable({
        "paging": true,
        "lengthChange": true,
        "searching": true,
        "ordering": true,
        "order": [[ 8, 'desc' ]],
        "info": true,
        "autoWidth": true,
       /* "scrollY": "500px",
        "scrollCollapse": "true",*/
        "language": {
            "emptyTable": "没有数据,请选择筛选条件",
            "search": "条件搜索:",
            "lengthMenu": "每页 _MENU_ 条记录",
            "zeroRecords": "没有找到记录",
            "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
            "infoEmpty": "无记录",
            "infoFiltered": "(从 _MAX_ 条记录过滤)",
            "paginate": {
                "sFirst": "首页",
                "sNext": "下一页",
                "sPrevious": "上一页",
                "sLast": "末页"
            }
        },
        // "fnDrawCallback"    : function(){
        //     this.api().column(0).nodes().each(function(cell, i) {
        //         cell.innerHTML =  i + 1;
        //     });
        // },
        "fnDrawCallback" : function () {
            var rows = [],nodes = myTable.column(2).nodes();
            nodes.each(function(cell,i){
                if(i != 0) {
                    if($(cell).text() == $(nodes[i-1]).text()) {
                        var row = rows.pop();
                        rows.push({
                            cell: cell,
                            rowspan: row.rowspan+1,
                        });
                    } else {
                        rows.push({
                            cell : cell,
                            rowspan: 1,
                        });
                    }
                } else {
                    rows.push({
                        cell : cell,
                        rowspan: 1,
                    });
                }
            });
            var index = 0;
            $(rows).each(function(cell,item){
                $(nodes[index]).attr('rowspan',item.rowspan);
                for(var i = 1; i<item.rowspan;i++){
                    $(nodes[index+i]).remove();
                }
                index += item.rowspan;
            });
    }
})


function selectChangeIframeHeight(obj){
    $("select[name="+obj+"]").change(function(){
        reSetIframeHeight();
    });
}


var CONSTANT = {
    DATA_TABLES : {
        DEFAULT_OPTION : { //DataTables初始化选项
            "scrollY": "100%",
            "bProcessing": false, // 是否显示取数据时的那个等待提示
            "bServerSide": true,//这个用来指明是通过服务端来取数据
            "bPaginate": true,  //是否显示分页
            "fnServerData": retrieveData, // 获取数据的处理函数
            "language": {
                "emptyTable": "没有数据,请选择筛选条件",
                "search": "条件搜索:",
                "lengthMenu": "每页 _MENU_ 条记录",
                "zeroRecords": "没有找到记录",
                "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
                "infoEmpty": "无记录",
                "infoFiltered": "(从 _MAX_ 条记录过滤)",
                "paginate": {
                    "sFirst": "首页",
                    "sNext": "下一页",
                    "sPrevious": "上一页",
                    "sLast": "末页"
                }
            },
            "retrieve": true,
            "destroy": true,
            "aaSorting": [[0, "desc"]], //默认排序
        }
    }
};

function retrieveData(sSource111, aoData111, fnCallback111) {
    $.ajax({
        url: sSource111,//这个就是请求地址对应sAjaxSource
        data: {"aoData": JSON.stringify(aoData111)},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
        type: 'post',
        dataType: 'json',
        async: false,
        success: function (result) {
            fnCallback111(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
            reSetIframeHeight();
        },
        error: function (msg) {
        }
    });
}


function decodeName(name){
    var context = decodeURIComponent(name);
    if(null != context && "undefined" != context){
        context=context.replace(/%20/g," ");
    }
    return context;
}}

function taFlush2(obj, rows) {
    $(obj).DataTable({
        /*        "paging": true,
         "lengthChange": true,
         "searching": true,
         "ordering": true,
         "order": [[ 8, 'desc' ]],
         "info": true,
         "autoWidth": true,*/
        /* "scrollY": "500px",
         "scrollCollapse": "true",*/
        /* "language": {
         "emptyTable": "没有数据,请选择筛选条件",
         "search": "条件搜索:",
         "lengthMenu": "每页 _MENU_ 条记录",
         "zeroRecords": "没有找到记录",
         "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
         "infoEmpty": "无记录",
         "infoFiltered": "(从 _MAX_ 条记录过滤)",
         "paginate": {
         "sFirst": "首页",
         "sNext": "下一页",
         "sPrevious": "上一页",
         "sLast": "末页"
         }
         },*/
        // "fnDrawCallback"    : function(){
        //     this.api().column(0).nodes().each(function(cell, i) {
        //         cell.innerHTML =  i + 1;
        //     });
        // },
//        "fnDrawCallback" : function () {
//            var X = this.api();
//            $.each(rows,function(n,value){
//                var n=value;
//                var rows = [],nodes = X.column(n).nodes();
//                nodes.each(function(cell,i){
//                    if(i != 0) {
//                        if($(cell).text() == $(nodes[i-1]).text() && $(cell).text() !="") {
//                            var row = rows.pop();
//                            rows.push({
//                                cell: cell,
//                                rowspan: row.rowspan+1,
//                            });
//                        } else {
//                            rows.push({
//                                cell : cell,
//                                rowspan: 1,
//                            });
//                        }
//                    } else {
//                        rows.push({
//                            cell : cell,
//                            rowspan: 1,
//                        });
//                    }
//                });
//                var index = 0;
//                $(rows).each(function(cell,item){
//                    $(nodes[index]).attr('rowspan',item.rowspan);
//                    for(var i = 1; i<item.rowspan;i++){
//                        $(nodes[index+i]).remove();
//                    }
//                    index += item.rowspan;
//                });
//			})
//
//        }

    })
}